﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
using UpLoadConsoleApplication;
namespace iSun.App
{
    public partial class frmEditConfig : Form
    {
        public frmEditConfig()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            DataAction.UpdateAppConfig("defualtSourceFilePath", this.txtDefualtSourceFilePath.Text);
            DataAction.UpdateAppConfig("filePath", this.txtFilePath.Text);
            DataAction.UpdateAppConfig("filePath1", this.txtFilePath1.Text);
            DataAction.UpdateAppConfig("SeverURL", this.txtSiteUrl.Text);
            DataAction.UpdateAppConfig("step1URL", this.txtSiteUrl.Text + "/AutoLogin.aspx?step=0");
            DataAction.UpdateAppConfig("step2URL", this.txtSiteUrl.Text + "/AutoLogin.aspx?step=1");
            MessageBox.Show("设置成功");
        }

        private void frmEditConfig_Load(object sender, EventArgs e)
        {
            this.txtDefualtSourceFilePath.Text = ConfigurationManager.AppSettings["defualtSourceFilePath"];
            this.txtFilePath.Text = ConfigurationManager.AppSettings["filePath"];
            this.txtFilePath1.Text = ConfigurationManager.AppSettings["filePath1"];
            this.txtServericeUrl.Text = "";
            this.txtSiteUrl.Text = ConfigurationManager.AppSettings["SeverURL"];

        }

        private void button3_Click(object sender, EventArgs e)
        {
            folderBrowserDialog1.ShowDialog();
            if (folderBrowserDialog1.SelectedPath != string.Empty)
            {
                this.txtDefualtSourceFilePath.Text = folderBrowserDialog1.SelectedPath + "\\";
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            folderBrowserDialog1.ShowDialog();
            if (folderBrowserDialog1.SelectedPath != string.Empty)
            {
                this.txtFilePath.Text = folderBrowserDialog1.SelectedPath + "\\";
            }
        }

        private void button5_Click(object sender, EventArgs e)
        {
            folderBrowserDialog1.ShowDialog();
            if (folderBrowserDialog1.SelectedPath != string.Empty)
            {
                this.txtFilePath1.Text = folderBrowserDialog1.SelectedPath+"\\";
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Hide();
            this.Close();
        }
    }
}
